package com.polimi.meteocal.business.entity;

import java.io.Serializable;

import javax.persistence.*;


/**
 * The persistent class for the ack database table.
 * 
 */
@Entity
@NamedQueries({
@NamedQuery(name="Ack.findAll", query="SELECT a FROM Ack a"),
@NamedQuery(name="Ack.findForInvite", query="SELECT a FROM Ack a "
								+ "WHERE a.id.eventId = :eventId AND "
									  + "a.id.ackSender= :inviteReceiver AND "
								      + "a.id.ackReceiver= :inviteSender")
})
public class Ack implements Serializable {
	private static final long serialVersionUID = 1L;
	public static final String FIND_ACK_FOR_INVITE = "Ack.findForInvite";
	@EmbeddedId
	private AckPK id;
	
	private String response;

	//bi-directional many-to-one association to Invite
	@ManyToOne
	@JoinColumns({
		@JoinColumn(name="ACK_RECEIVER", referencedColumnName="SENDER"),
		@JoinColumn(name="ACK_SENDER", referencedColumnName="RECEIVER"),
		@JoinColumn(name="EVENT_ID", referencedColumnName="EVENT_ID")
		})
	private Invite invite;

	public Ack() {
	}

	public AckPK getId() {
		return this.id;
	}

	public void setId(AckPK id) {
		this.id = id;
	}

	public String getResponse() {
		return this.response;
	}

	public void setResponse(String response) {
		this.response = response;
	}

	public Invite getInvite() {
		return this.invite;
	}

	public void setInvite(Invite invite) {
		this.invite = invite;
	}

}